package com.zoshine.zzg.controller;

import com.github.pagehelper.PageInfo;
import com.zoshine.zzg.base.BaseResponse;
import com.zoshine.zzg.pojo.PrisonerAccount;
import com.zoshine.zzg.respons.AppResponse;
import com.zoshine.zzg.service.PrisonerAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 犯人账户Controller
 * @author 田沛凌
 * @time 2017年7月7日 下午9:47:13
 */
@RestController
@RequestMapping(value = "prisonerAccount",method = RequestMethod.POST)
public class PrisonerAccountController {

private PrisonerAccountService prisonerAccountService;
    
    @Autowired
    public void setPrisonerAccountService( PrisonerAccountService prisonerAccountService) {
        this.prisonerAccountService = prisonerAccountService;
    }

    /**
     * 查询账户集合
     * @param prisonerAccount
     * @return
     */
    @RequestMapping("/pagePrisonerAccount")
    public BaseResponse pagePrisonerAccount(PrisonerAccount prisonerAccount){
        
        List<PrisonerAccount> listPrisonerAccount = prisonerAccountService.list(prisonerAccount);
        
        return new AppResponse(new PageInfo<>(listPrisonerAccount));
    }

    /**
     * 根据犯人ID获取账户
     * @param id 犯人ID；
     */
    @RequestMapping("/getPrisonerAccount")
    public BaseResponse getPrisonerAccount(Long id){
        PrisonerAccount prisonerAccount = prisonerAccountService.get(id);
        return new AppResponse(prisonerAccount);
    }
}
